//
//  NewsComment.m
//  SportSocial
//
//  Created by yull on 15/1/5.
//  Copyright (c) 2015年 yull. All rights reserved.
//

#import "NewsComment.h"

@implementation NewsComment

+ (instancetype)newsCommentWithDict:(NSDictionary *)dict
{
    NewsComment *newsComment = [[NewsComment alloc] init];
    
    for (NSString *key in dict.allKeys) {
        id value = [dict objectForKey:key];
        if ([value isKindOfClass:[NSNull class]]) {
            value = @"";
        }
        
        [newsComment setValue:value forKey:key];
    }
    
    return newsComment;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        [self setValue:value forKey:@"commentId"];
    }else {
        [super setValue:value forUndefinedKey:key];
    }
}
@end
